<template>
	<!-- 轮播图区域 -->
	<swiper class="swiper-container" indicator-dots indicator-color="#fff" autoplay interval="3000" circular>
		<!-- 轮播项 -->
		<swiper-item v-for="(item, index) in SwiperList" :key="index">
			<view class="item">
				<image :src="item.url"></image>
			</view>
		</swiper-item>
	</swiper>

</template>
<style>
/**index.wxss**/
.swiper-container {
	width: 100%;
	height: 380rpx;
}

.item {
	height: 100%;
}

.item image {
	width: 100%;
	height: 100%;
}

@media screen and (min-width: 600px) {
	.swiper-container {
		width: 100%;
		height: 500rpx;
	}

}
</style>
<script>
import { getSwiper } from '@/store/api.js'
export default {
	mounted() {
		uni.$on('flushed', (val) => {
			console.log('收到')
			this.SwiperList = []
			getSwiper().then(res => {
				console.log(res)
				this.SwiperList = res.data
			})
		})
		getSwiper().then(res => {
			console.log(res)
			this.SwiperList = res.data
		})
	},
	data() {
		return {
			SwiperList: []
		}
	}
}
</script>